Improved to_number, added comparisons, fixed bug