Major refactoring + jdbc