refactor code

use named constructors, wrap requests / responses in their own class