refator code