code with some more changes