small rearranging of code + comments