Added bug fixes and changes from HW6