Added about half of the existing src (rewrite will come later)