Major and monor bug fixes, second pass at files