updated code with fixed version