Allowing user to specify mask for contours~().
Small bug fixes.