major refactor and restructure, new client functions system
Various minor bugfixes