main problem succesfully solved