Remove unused code and the unneccesary console.log calls