finally finished basic functionality