Clean up code, extract constants