Reorganizing, adding tests, setting up basic router functions