removed excess code and improved code styling