Minor nitpicks and debug prints added