Add missing mark cleaning and refactor mark phase