Add tests & refactor entity