Fixed Null Pointers, cleaned up and updated code

Title says all