code refactoring, added local storage usage for storing theme preference