Code quality improvments