Updated to current compilation standards; TODO fix overuse of *mut instead of *const