Added wagn code to port to a gem