Finished porting (minus the decision on whether to integrate ktech or not; the Unix version currently uses it)