Converting code to make Java 1.5+ compatible.

Also refactored Loader class to make it more manageable.