pulled some constants out of the function