Refactoring to lightweight version