finished code, todo design