Minor improvements and documentation. TODO: implement optimize()