Added the rest of basic gates, reorganized code and comments.