refacto to follow spec