best_practices refactor