expanding and bugfixing class