updated the implementation of levels