cleaning up the code based on anton's commit
cleaning up based on anton's commit (2)