Debuging and optimizing