Added new feature for switching between debug and optimized