Rearranged and removes unused/bloated functions