Refactoring perf

Fixes #33