Add test for apply with identifier
Refactor