Beanstalk, refactor, bugfixes, API