added and modified code A3