cleanup and adding unit test
even more test cases
added notes for ML lecture