Clean up command system and add Javadoc