Merged changes from Framescheduler, a number of bugfixes, all but one unit test fixed, corrected occasional segfault.