experimental commit, removed debug statements, but should be correct