Remodified the code