defined Unit Tests, fixed obvious bugs
forgot a few