Comments added and code improved with enumerations.