Added prepared queries for a speedup