Fix unit tests

Also make minor code cleanup in cent.js.