Various tweaks, using int return values to check variuos operation results.