mainly refactor of code, added sampleinfo struct