Expose realm. Closes #2235. Closes #2230