max command limit = 1 and removed code duplication