logic for levels - basic and ugly - but quick