better endpoint handling, formatting