Removed dead code and added comments.