added date filter and tidied a few things up