more stuff in writing, refactored