Added code for clearing interrupt and correctly configuring interrupt