refactored and fixed code inspections