Implemented Task6 and Task7