Cleaned all legacy stuff in resutil module.

Also moved some generic utilities from rest to restutil.