Implement fold
Add very basic test