First pass at a cleaner state system. Prior to breaking old code