Editted style and comments, removed else case