Bug fixes + merging Tomy's work