Added karma and wrapped everything in closures