Code refactoring. Build from XML is not working now