some improvments - little refactoring