Code from CS61 course from UC Berkeley.