Refactor out file scanner into separate package