slight bugfixes, start work on tests