updated variable declarations and added comments