improved for easy testing