Added protection from sql injection and dubug flag