minor code tweaks, removing redundant variables