Added first functional tests and minor changes