Adding support for base < 5

Supersedes [#56]