Fixed issue 1 and rewrote comments.
Rewrote more comments and remove redundant imports.