added writeup and cleaned code