Cleaned up coded for better readability