minor fixes & refactoring
strat to writing some test cases
more test cases things