Congratulations on solving the problem.
Bitlash is a language interpreter that runs on the Arduino. It implements a simple language that is similar to C, and many of the customary Arduino library functions are built in. You can use the Bitlash library from your sketch, and expose functions from your C code as Bitlash functions.
More at http://bitlash.net or you can go straight to the book: http://bitlash.net/bitlash-users-guide.pdf
-br