first big refactor and warning