refactored autoloader to support before and ready functions of the passed component object