code now alot better and more precise, i dont think it can really be done better, if anyone has any suggestions please let me know