Updated and fixed up for sanity and function.