updated to have callbacks to validate paths