tried to improve a lo, will add error test if my code works out