function structure changed in attendance module to improve perf - changes to attendance block required for this version.