refatoring code