Final version-Everythings works correctly