Added level switching and generalized triggers

Signed-off-by: James Hagborg <jameshagborg@gmail.com>