rafactor code