remove constants, move function to more appropriate locations