Moved things around to try to solve a bug