Moved some stuff around
fixed refs