enhancement - added some comments and moved some lines within switch statement