cleaned up some dupe code