Minor refactoring and memory allocation fixes plus change of formatUnixTime's signature to address referential transparency issue.

See issue #12 for details.