Enh: refactored some code and improved labels