Cleaned up code, but did not change functionality