Refactored the entire process to command exec pattern