Major updates, major bugs. Please help debug this code...