Simplify hideous conditional blocks with declarative logic