Added test for atom, and changed code to make it work