Refactoring screensaver code

Removing unused code
Removing duplicate code