added student count and refactored