Applied No-else-after-return coding style.
All null checks are now done in the public API as a convention.
Some reordering of methods for increased readbility top-down.