Added implementation for #10, tests still missing.