rearranged some stuff and changed it to trigger-based execution

fixes #3