First round of filters and hooks

Add filters and hooks, domain variable, misc clean