modified the functions