cloned from tatey.com and cleaned up