finish code and add writeup