Changing everything to use prepared statements