[#49] refractor code