Rearranged and fixed some stuff