bugfixing and cleaning.