Refactored, added logging, etc