Clean up and simplify code API, further resolves #3, reworks #5.