[WIP] Adding decimal support

This code is shared between the branches, so you can move it out.