Some more work done(fixed crashes)