reformatted, commented, added todos