added optimization again