Changed from ROM functions to library functions