added some fixes for part 4 and deleted old code