version 3, close to be done!