Adding specs and refactoring some methods