cleaning up design and fixing bugs