better tests and cleaned up api