finished basic implementation