Massive cleanup, including adding some basic documentation