Split class loading and instantiation in two methods

Also, fix the Javadoc.
Add updatePrepared to QueryGenerator

Also, fix indentation.