Refactored gem to be cleaner and easier to read and use.