Removed duplciate function, rearranged some calls