Improved formatting of code and removed unnecessary console logs