Added test. Some minor package refactors.