changed sequence of code. Moved autoload handling to bottom. Added documentation as to why.