fefactor code