Tidying up, adding sanity test