Big do-it-all commit. Work on this is not finished and there are a few changes that need to be undone. A bit messy but that's how it is :/