Added the bindParams function to prevent sql injections and refactored code to make it a more clean implementation