Some improvements on the codebase