some pointless variables removed