modified to use prepared statements(Priya)