Refactor design

This PR includes some design changes which are outlined in the README.