Remove dependency on underscore and add tests