Refactoring (as per discussion with @aliubunia)