added helpers and correct sorting of active contacts