Moves most logic into autoload. Gets enter and exit states working.