update dependencies, refactor a bit