initial copy, working on apply function