more on contacts plus various refactoring