changed scope of callback, trying to track down a bug
replace accepts filepath as argument