Reworking of conversion module

Replaces all lambdas with expanded functions with documentation and
better error detection.