Updated codes to make it work on both Creedence and Clearwater

And minor bug fix.