added getLevel function