Refactoring: cleanup, fix and compliants