Made modifications to make program work