moved things around to be a bit cleaner