Converted more queries to use parameterised queries