debugged and made the code compile