moved constants to local values in function