Merged peter's changes