moved module destination to a variable, added some exception handling