Crash Fixing & some more refactoring