Moved some stuff around, shortened code

Clean up code, move some functions around, removed isDead because
unnessecary