moved private methods to the file where they are used