Added assertions, refactored tests