Fix some things after major refectoring below.