* finished basic logic