Moved around some things for readability