dramatically changed almost everything

All works now, next some commenting and lots of code cleaning