removed console.log and cleaned up code