API Added paramaterised queries
API Convert queries to use paramaterised queries
Code tweaks and fixes, continued cleanup of @todos