Moved code around to match style