Changed logic to typeswitch and added comments.

And also added my name to contrib list as promised before.