Fixed Crashes and Code Cleanuo