refactor and usability improvements