Refactoring + tests around risk analysis and loan