Code for CS199