updated code and writeups