Refactor, add error handling

- Also adds in Underscore for convenience