added command loop