Moved code for readability.