updated some awkward parts, formatted w/ Astyle