more rigorous constness and avoid copying

avoid unnecessary copying and reduce mutable surface