Somehow working version