return function working, ready to merge