fixing coding style, more comments, more paragraph seperating