Need to check why is it wrong with closed figures, such as triangle and squares.