Numerous improvements to routines dealing login items. Improved resource handling and fixed resourse leakes.