Bugfixes and missing features
Adding tests