just a few function additions and tweaks