Changed to using an execution context to simplify the code a bit. Closes #10.