added FILTER, tidied up a few comments, and renamed startloop to the more descriptive doenum