Make many methods and attributes of classes private

Make most variables, functions, slots etc. private instead of public.

Also make the constructors explicit.