Lots of changes related to preparation to RMI. Many fucntions renamed
and deleted.