Code and docs small refactor and cleanup