nearly finished with Anthony's fixes on pull request