global cleanup & refactor & more