Removed extraneous SQL queries