Issue 4

Rebased previous PR.