Some fixes
Working version