Extended targetting

This is the cleaned up version of the multi-target branch including required fixes.

Closes #54