major library cleanup. prototype based