Moved code block into proper place