Refactor for better code clarity