added optimization and debugging options