end of the function return should be changed to "return ret" ?