refocatoring code