Refactor and add more specs