little refactoring based on recent changes