refactor, add specs