make filesmap to be a defined function