Copied over from other project to make this available as a gem