Implementation for course project 1