refactored tests and formatted views