linux: some codebase refactoring / generic methods / some hot fixes