Core re-write. Making everything properly functional.