Add history feature; group some functionality into subpackages