Completed first implementation of minimize, still needs to get tested