used ceil() and fixed stuff