Cleaned up a few sections of code a bit