Added result method and a little code cleanup