simplify layers (solve brackets etc.)