Add a function for retrieving mode

- I'm not sure how useful this will be.
- This function is outside typical use but may be simpler
  than misusing the fraction.
- I also identified a few places for refactoring which I'll fix later.