code for task#923 and task#924