Refactored code and added several helpful utility functions to increase efficiency & usuability.  Also added a new "ranking" example.