Added Foundation

Methods ported over from C4Foundation.m, many of which became
irrelevant (e.g. sort functions)