This is starting to work fairly well