More conversions, generalizations and bugfixes.