Cleaned up a bit of code