tests and refractoring