new methods
moved some calc out of loop