updating and refactoring test