style changes, auxiliary method instead of mutual variable added