needs a bit of work, but not bad for a quick hack.