Small fixes. Rather working version