Removed console log and optimized a bit