improved writeup based on professor feedback