all works, but full of debug statements
remove debug printout, add asserts