remove sql class function calls in favour of PDO calls + minor fixes