Refactored code and added function to separate the Classes By Day/Period/Schedule