Fixed errors and removed Debug messages