More code refactoring - before final run