Added additional code to accomodate files, geometry and user error;