Added explanatory comment block at the top
Some reformatting and cleanup