Refactor and break out cli functions in seperate modules