rewritten for clarity and detail