Added gradient handler and flags