functioning again need to refactor