Refactor and prepare for notification support

This PR does not add notifications, but preps for it by renaming some functions and vars, fixing comments, and handling how we move data around a little better. This way my notification PR will be cleaner.
Actualy we dont need to cast it at all, we can just use it below. its only used once.