move prepared statement generation into own class