Alerts

incorporated alerts functionality for v4 API, and a bunch of other cleanup for pkg