This took awhile but should be easier now