Fixed alert counter; Optimized some things