debug and add comments