moved greyd extern functions into separate module