change init code to support multiple cards. small fixes and corrections to code.