finished functionality for cs 334 project