Refatoring the class