use $c and $app instead of $self in many places