Changed var to atom, added test cases