A subpart of CS246 project