Refactoring, cleaning up and supporting commands