performance refactor, organized framework