Mihawk patch 2

Pulled in Mihawk's patch and refactored and added a few tests