refactoring for compact size