Adding some functions to spy

also revised some stuff to make it more fluent and less cluttered