Minor fixes in variables and cleanup