created Enum datatype for the modes and commented most of the codes