main func command parsing