[EDIT] A little refactoring.