modified to use cwd