Created adjustLevel function