clean stuff and refactor