implemented assignment2