partial implementation of part 4