refactor with classes. First draft, names need to be adjusted.