update the Codes , rewrote some of codes + fixed some of issues