updated coded with calculations and stuff