refactored the credit scripts