first loop is the first thing i made in pxtoneending added later (i think it works better without it actually)