working on function looping