Remove dead code
Add perl implementation for testing