rewrote because I have no idea what this script was for.