squashed minor bugs, started refactoring tests