added credit system to entire process. fully tested