big refactor
require fixes