Debuging and deleting redundant code