Minor adaptions and cleanup for set 4 code