Implement purge route, add unit tests