finished ghost along with major reworks to previous code