Added code & suggestions from Jerome @ dev252