added the ability to return the result as object