Controversial changes - this all works - maybe there's a better way