Added labels and refactored code