Work in progress, i.e. NOT FINISHED. Lots of changes, so this might break stuff.