restructured complex method in github plugin