credits and more code optimization