cleaned up the code and made some optimizations