Reorganize getActiveClass method