refactor

use of _.wrap instead of recreating an "extend" wrapper
added more unit testing