Combined Jay's code and a few UI changes