code cleanup
bugfixing