refactor preparestatement