Adding finished code for prepared statements