move impl to .cpp
check for trailing slash