Refactoring/cleanupxy