removed comments and optimized the code