Complete version with testing pass