refactored for better label handling