Removed some doubled and unused code and corrected some comments.