improving cucumber tests + refactoring code