final version for the moment, all appreciable bugs fixed