added several improvements