Removed debug prints from g() function