Code improvements and removed un used codes