Cleaned up the code alittle