Adding beginnings of optimization