Split into several files, easier to read. Small fixes.