refactored: added proper comments, redefined var names, declarations, an...

...d initializations