remove all warnings and change indecies to use reflection