Added pre-block setting instance variables and took out repeated code from 'in' and 'out' blocks