Move up common code in readElement().