Prototype rewrite for modern perl