Fixed code as recommended in code reviews