fixed error on loop
fixed all functions and finalized project