made some refatoring changes