Core: refactor storage layer, pt.9 (#391).

The Core compiles! For the first time since 3 days. Yippie!

Not yet functional.

See ticket 391.