Updated code; removed debug flags