Moved shared functions to Wright core