Added small modifications to the code