More debug statements and bug fixes. At this stage all basic data is stored correctly except dependencies