Improved const correctness and numeric restrictions.