core logic finished; @sidazhang + @vincentstorme