refactored variable assignment