Version 1.0.4: exception handling added.