Logic updated and first Junit-Tests added