Fixed bad block select code. Added input checks and case statements