Refactored rnotify script