refactor rain