Cleaned up and got it working again with latest version of angular