I have added improvements to this thread.