a first working refactored raintime