changed levelmem to level