adding better result and context handling with appropriate tests.