Updated to getcwd, since getwd was deprecated