Various additions and fixes