Moved code out of layout subviews.