added basic logic and tests