All of my UVa solution