some refatoring