updated with Julian's changes