Fixed all the warnings and added a test case for `remove_orphan_watched_resources()'