moved some data calcs around