added more credit checks
refactor
updated test