Fixed some redundancies and crash-causing problems.