An alternative to my foxy script written in C