added final and removed unused codes