added all the stuff needed to share this code with the world
merged from head