New functions + fixes and tweaks