cleaned up code, added struct docs

cleaned up code, added struct docs