Cleaned up CLI code