Same as before with some comment and things fixed