Code polished, commented and JSLint compliant [Fix #9]