move another function out of 'connection'