more elegant approach