By TravisCarden: Refactored module with an emphasis on API design.