Refactored to bare minimum.