initial complete implementation