input Kelly's changes and comments
rewrite hks replication section