Added format method.

Fixes #5