Reworked some stuff to fit local changes