this whole block is the same, just indented, only new thing is the below optimization