Some code refatoring.