refactored: broken up cmd to tree and tests