switch to use own functions