Code cleanup

General code cleanup made while reviewing code.