Added Big O efficiencies