fixing issue #7
adding tests and fixing issue #6
fixing conf intervals in KM