Changed setID

Changed setID and cleaned up code a bit