fixed calculations and changed layout