another round of functions improvements