General refactor, luigi and base states