init; various functions. May be moved later