rewrite geom using pattern matching <3