Removed unused commands and fixed visibility of variables and methods