cleaned up code, and removed underscore dependency