protected function authenticate($pgUsername, $pgPassphrase, $pgPrivateKey)
    {
		//Determine the type of authentication to use.
		if( is_null( $pgUsername ) ) {
			pecho( "A username must at least be specified to authenticate to the server,\neven if there is authentication is none.\n\n", PECHO_FATAL );
			return false;
		}
		$fails = 0;
        if (!is_null($pgUsername) && !is_null($pgPrivateKey) && $this->protocol == 2) {
			pecho( "Authenticating with Private Key Authentication...\n\n", PECHO_NORMAL );
            $key = new Crypt_RSA(); // FIXME    Class doesn't exist
            if (!is_null($pgPassphrase)) {
                $key->setPassword($pgPassphrase);
            } // FIXME    Method doesn't exist
            $key->loadKey(file_get_contents($pgPrivateKey)); // FIXME    Method doesn't exist
            if ($this->SSHObject->login($pgUsername, $key) && $this->SFTPObject->login($pgUsername, $key)) {
				pecho( "Successfully authenticated using Private Key Authentication.\n\n", PECHO_NORMAL );
				return true;
			}
			$fails++;
		} else $fails += 5;
		if( !is_null( $pgUsername ) && !is_null( $pgPassphrase ) ) {
			pecho( "Authenticating with Password Authentication...\n\n", PECHO_NORMAL );
            if ($this->SSHObject->login($pgUsername, $pgPassphrase) && $this->SFTPObject->login($pgUsername,
                    $pgPassphrase)
            ) {
				pecho( "Successfully authenticated using Password Authentication\n\n", PECHO_NORMAL );
				return true;
			}
			$fails++;
		} else $fails += 5;
		if( !is_null( $pgUsername ) ) {
			pecho( "Authenticating with No Authentication...\n\n", PECHO_NORMAL );
            if ($this->SSHObject->login($pgUsername) && $this->SFTPObject->login($pgUsername)) {
				pecho( "Successfully authenticated with No Authentication\n\n", PECHO_NORMAL );
				return true;
			}
			$fails++;
		} else $fails += 5;

		if( $fails == 15 ) {
			pecho( "An incorrect combination of parameters was used and therefore, no proper authentication can be established.\n\n", PECHO_FATAL );
			return false;
		} else {
			pecho( "Peachy was unable to authenticate with any method of authentication.\nPlease check your connection settings and try again.\n\n", PECHO_FATAL );
			return false;
		}
	}