Updated and reduced code.