refactory to improve the usability