moved code to ghostlib and ghostmath