update with functions and working regex