little refactor for speed