Re-organization, updated deprecated functions, and other fixes.