Refomatted a bit, added some comments, deleted unused legacy file