expand panel logic