Pick layout based on current orientation.
Fixed record uniqueness check.