cleaned up and more readable