Refactored commands and added comments.