extract helper method to determine which css class to apply