Removed redundant includes and did some refactoring.