added RFC2617, refactors and reorgs