Some code cleanup, added tests for base options