Refactored to reactor. Fixes #42