Added return function and other stuff