Moved conversion functions to library