refactor and basic setup