Refactored tests and views