Better domain function
Better error message