merging two fnctionalities