Refactored, removed unneccessary code.