Extracted main in cli