refactor

big refactor...