Adding features and bugfixing