Refactor misc