Optimized code based on JSLint;
Added demo page (AngularJS)