More geometry code for correct polygon outlines