add [] method on result and refactor