public function register($name, $closure = null, $options = array())
	{

		// Set default options
		$options = array_merge(array(
			'prepend' => false)
		, $options);

		// No method given?
		if (!$closure) {

			// Use the name instead
			$closure = $name;
		}

		// Not valid?
		if (!in_array($name,self::$validCallbacks)) {
			throw new ActiveRecordException("Invalid callback: $name");
		}

		// Is it a method?
		if (!($closure instanceof Closure))
		{

			// Load class its public methods
			if (!isset($this->publicMethods)) {
				$this->publicMethods = get_class_methods($this->klass->getName());
			}

			// Is there no public method by that name?
			if (!in_array($closure, $this->publicMethods)) {

				// Was the method private?
				if ($this->klass->hasMethod($closure)) {

					// Method is private or protected
					throw new ActiveRecordException("Callback methods need to be public (or anonymous closures). " .
						"Please change the visibility of " . $this->klass->getName() . "->" . $closure . "()");

				} else {

					// Just a non-existing method				
					throw new ActiveRecordException("Unknown method for callback: $name" .
						(is_string($closure) ? ": #$closure" : ""));

				}
			}
		}

		// Add method/closure to the registry
		if (!isset($this->registry[$name])) {
			$this->registry[$name] = array();
		}
		if ($options['prepend']) {
			array_unshift($this->registry[$name], $closure);
		} else {
			$this->registry[$name][] = $closure;
		}
	}