Initial ghost battle code
merged from master