Cleaned up redundent code, tried to make the readability a bit better.