Finished proper THD implementation

Still needs a bit further integration.