I use Flushmem at the end of each function and my main loop just contains calls to the functions so i havent got a flushmem in that (although if i do put one in it wont work).
That won't work. Flushmem works within it current scope so if you call it in a function it will only flush memory used by that fuction call.
Just put the flushmen in your main loop once.