many changes to convert and spec bugfixes, updated to match specification