main functional finished, pre-bugfixing