code improvements, code beautification, more and better comments