clean up and implement validation functional test
move unit tests