few enhancements and adding karma for tests