Patched and repaired all functions