modified to add new function