refactor + organisation code