creating result object and returning