refactor code, use new libs