cleanup unused code optimize tests