with a lot of minor changes because of debugging