modified for testing and packaging