initial version with some stuff working
little refactoring
little refactoring
merging