code with horrible debug statemewnts