Updated code from fork.