Major refactor changes

Changed most of plain jdbc code to spring jdbc template