Finish code and writeup