code fixes, comments. Minified version