refactored into modules, added filter and arg parsing