remove debug prints and add a bit of documentation