updated fixed code