Refactor quota checking logic and modify alert class