modified custom functions