Moved filter closure into MyFilter class

Signed-off-by: David Hughes <david.hughes125@gmail.com>