logic finished. tests to do now.