Cleaned up some code

Not sure if it is any better though