expand/collapse code uses ifs instead of error handling