borrow from alex's marking script