File format fixes

Temporarily broke referred objects, but file structure is cleaned up.
Will fix ships next.