End of code cleanup, fixed multiple issues:
1. Student and activity rows and ids are now handled independently
2. DB code seperated out.
3. removed lots of duplicate code.
4. added ability to limit an activity for each period.