added some handling for levels