small modifications to the code