Most of assignment 1