Updated for bugs