msf recommended changes + tweaked exception handling