Bit of refactoring

Decided to break apart some of the larger methods into smaller ones. Working on a test suite for this locally to support these changes, will add later. Thanks for the plugin, very helpful.