Data directory made relative, code tidy up