Refactor config into runtimeenv

@theneikos please review.

Solves #38