style clean up; fix modulo error in <<; add a few more test cases