optizations and debug