Modularize backend.
Started restoring C backend.