Add better specs and a bit of refactor