Working solution for project 2