Implement issuing leaves, minor refactoring.
Added extensions