Add new functions and bugfixes