replaced function! woth function