Refactor code & specs for Environment#setup