Fixed #isup
Comments added
fixed some other functions
rearranged code