refactored stroke and fill logic to eliminate duplicated logic