refactored code and deleted some old commands