remove garbage and add comments
fix order of initialization