comments added and code was optimized