Clean up and add support for different integer bases.