Edited to follow Ruby conventions more closely