fixed variable decleration, added a couple tests