Improved rational number class