Refactor method invocation parsing