Issue 30: Optimizer routine needs tests

fixes #30