added loop, refactored individual commands