removed some small bugs
further tweaking