Feature/refactor

Should be mostly done