reverting this to match master branch except for pertinetn changes