Fannie prep statements

Replace plain queries with prepared statements.