Cleaned the code to use commander api