formatted code and replaced hard-coded values