fuck yea, working atom method
cleaned up version