optimizer seems to work, needs testing