Fix tests, remove old code