partial rewrite of basic functionality