moved functions around to make more objected oriented, fixed imports