Minor changes and code cleanup