more work on issues and refactor