new implementation of several functions