Working version for part 1