rewrite of most code