Autoloader

Sending pull request again.

Includes some fixes that weren't present in the previous request.