Various bug fixes
Add metric mode, fixes #16