simplify as suggested by @avsm