rename of vars and functions to make it easier to read, and fixed onHeaderClick bug